<!DOCTYPE html>
<html lang="">
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta
      name="viewport"
      content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0"
    />
    <!-- 钉钉分享 -->
    <meta property="og:title" content="3.8女王节治愈好物专场" />
    <meta property="og:description" content="多款爆品，心动福利，治愈每个她" />
    <meta property="og:image" content="http://sino-sources.com/h5a1/h/heardrImg.jpg" />
    <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
    <title>天猫官方爆款清单</title>
  </head>
  <body>
    <noscript>
      <strong
        >We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work
        properly without JavaScript enabled. Please enable it to
        continue.</strong
      >
    </noscript>
    <div id="app"></div>
    <!-- built files will be auto injected -->
    <script>
      //兼容UC竖屏转横屏出现的BUG
      //自定义设计稿的宽度：designWidth
      //最大宽度:maxWidth
      //这段js的最后面有两个参数记得要设置，一个为设计稿实际宽度，一个为制作稿最大宽度，例如设计稿为750，最大宽度为750，则为(750,750)
      ;(function(designWidth, maxWidth) {
        var doc = document,
          win = window,
          docEl = doc.documentElement,
          remStyle = document.createElement('style'),
          tid

        function refreshRem() {
          var width = docEl.getBoundingClientRect().width
          maxWidth = maxWidth || 540
          width > maxWidth && (width = maxWidth)
          var rem = (width * 100) / designWidth
          remStyle.innerHTML = 'html{font-size:' + rem + 'px;}'
        }

        if (docEl.firstElementChild) {
          docEl.firstElementChild.appendChild(remStyle)
        } else {
          var wrap = doc.createElement('div')
          wrap.appendChild(remStyle)
          doc.write(wrap.innerHTML)
          wrap = null
        }
        //要等 viewport 设置好后才能执行 refreshRem，不然 refreshRem 会执行2次；
        refreshRem()

        win.addEventListener(
          'resize',
          function() {
            clearTimeout(tid) //防止执行两次
            tid = setTimeout(refreshRem, 300)
          },
          false
        )

        win.addEventListener(
          'pageshow',
          function(e) {
            if (e.persisted) {
              // 浏览器后退的时候重新计算
              clearTimeout(tid)
              tid = setTimeout(refreshRem, 300)
            }
          },
          false
        )

        if (doc.readyState === 'complete') {
          doc.body.style.fontSize = '16px'
        } else {
          doc.addEventListener(
            'DOMContentLoaded',
            function(e) {
              doc.body.style.fontSize = '16px'
            },
            false
          )
        }
      })(750, 750)
    </script>
  </body>
</html>
